package com.k.kpp.config.ftp;

import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

/**
 * @author kivil
 */
@Configuration
public class FtpClientConfig {

    @Bean
    @ConfigurationProperties("ftp.client")
    public FtpClientProperties getFtpClientProperties(){
        return new FtpClientProperties();
    }
    @Bean
    @ConfigurationProperties("ftp.pool")
    public FtpPoolProperties getFtpPoolProperties(){
        return new FtpPoolProperties();
    }

    @Bean
    public FtpClientFactory getFtpClientFactory(FtpClientProperties ftpClientProperties){
        return new FtpClientFactory(ftpClientProperties);
    }

    @Bean
    public FtpClientTemplate getFtpClientTemplate(FtpClientFactory ftpClientFactory,FtpPoolProperties ftpPoolProperties){
        return new FtpClientTemplate(ftpClientFactory,ftpPoolProperties);
    }
}
